#import "LayerSetPos.h"
#import "LayerLogo.h"

#import "OpenFeint/OpenFeint+Dashboard.h"
#import "SimpleAudioEngine.h"

@implementation SceneLogo

-(id)init {
	if ((self = [super init])) {
		[self addChild:[LayerLogo node]];
	}
	return self;
}

-(void)dealloc {
	[super dealloc];
}

@end


@implementation LayerLogo

- (id) init {
	if ((self = [super init])) {
		CGSize size = [[CCDirector sharedDirector] winSize];
		int w = size.width/2;
		int h = size.height/2;
		
		// Background
		CCSprite* bg = [CCSprite spriteWithFile:@"LogoBg.png"];
		[bg setPosition:ccp(w, h)];
		[self addChild:bg];
		
		// Logo
		CCSprite* logo = [CCSprite spriteWithFile:@"Logo.png"];
		[logo setPosition:ccp(w, 350)];
		[self addChild:logo];
		
		// Menu
		// Play
		CCMenuItemImage* play = [CCMenuItemImage itemFromNormalImage:@"Play.png"
													   selectedImage:@"PlaySel.png"
															  target:self
															selector:@selector(play)];
		CCMenuItemImage* score = [CCMenuItemImage itemFromNormalImage:@"Score.png"
														selectedImage:@"ScoreSel.png"
															   target:self
															 selector:@selector(score)];
		
		CCMenu* menu = [CCMenu menuWithItems:play,score,nil];
		[menu alignItemsVerticallyWithPadding:0];
		[menu setPosition:ccp(160,150)];
		[self addChild:menu];
	}
	return self;
}

-(void)play {
	[[SimpleAudioEngine sharedEngine] playEffect:@"Menu.wav"];
	[[CCDirector sharedDirector] replaceScene:[SceneSetPos node]];
}

-(void)score {
	[[SimpleAudioEngine sharedEngine] playEffect:@"Menu.wav"];
	[OpenFeint launchDashboard];
}

-(void)dealloc {
	[super dealloc];
}

@end
